<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>智能门禁管理</title>
    <link href="css/common.css" rel="stylesheet">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <!--<link href="css/font-awesome.min.css" rel="stylesheet">-->
    <link href="css/control.css" rel="stylesheet">
    <link href="css/access_control.css" rel="stylesheet">
    <link rel="stylesheet" href="css/font-awesome.css">
    <link rel="stylesheet" href="css/font-awesome-ie7.min.css">
    <style>
        .cell-input{pointer-events: none;}
    </style>
</head>
<body style="cursor: pointer">
<div class="refer_box ">
    <div class="clearfix">
        <div class="lf refer_box_title">
            <span>*</span>PID:
        </div>
        <div class="lf refer_box_input">
            <input class="pid" type="text">
        </div>
    </div>
    <div class="clearfix">
        <div class="lf refer_box_title">
            <span>*</span>激活码:
        </div>
        <div class="lf refer_box_input">
            <input class="new_key" type="text">
        </div>
    </div>
    <div class="clearfix" style="position: relative">
        <div class="lf refer_box_title">
            <span>*</span>门禁类型:
        </div>
        <div class="lf refer_box_input" style="position: relative">
            <input class="type" type="text" readonly="readonly" placeholder="请选择类型" data-type="">
            <i class="fa fa-angle-down"></i>
        </div>
        <ul class="refer_box_input_box">
            <li data-type='0' type="0">单元门禁</li>
            <li data-type='1' type="1">公共门禁</li>
        </ul>
    </div>
    <div class="clearfix" style="position: relative">
        <div class="lf refer_box_title">
            <!--<span>*</span>-->
            楼栋:
        </div>
        <div class="lf refer_box_input building" style="position: relative" >
            <input class="floor" type="text" readonly="readonly" placeholder="请选择楼栋" data-sId="">
            <i class="fa fa-angle-down"></i>
        </div>
        <ul class="refer_box_input_box building-box">

        </ul>
    </div>
    <div class="clearfix" style="position: relative">
        <div class="lf refer_box_title">
            <!--<span>*</span>-->
            单元:
        </div>
        <div class="lf refer_box_input cell_mark cell-input" style="position: relative" >
            <input class="unit" type="text" readonly="readonly" placeholder="请选择单元" data-sId="">
            <i class="fa fa-angle-down"></i>
        </div>
        <ul class="refer_box_input_box cell-box">

        </ul>
    </div>

    <div class="clearfix">
        <div class="lf refer_box_title">
            <span>*</span>门禁名称:
        </div>
        <div class="lf refer_box_input">
            <input class="new_name" type="text">
        </div>
    </div>
</div>
</body>
<script src="js/jquery-1.11.3.min.js" type="text/javascript"></script>
<script src="js/layer.js"></script>
<script src="js/common.js" type="text/javascript"></script>
<script src="js/ajax_data.js" type="text/javascript"></script>
<script src="js/access.js" type="text/javascript"></script>
<script src="js/access_control.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script>
    var pass=getQueryString('pass_a');
    var checkCode_val=getQueryString('checkCode_s');
    $('.pid').val(pass);
    $('.new_key').val(checkCode_val);
</script>
<script>

$('.building').on('click',function () {
    building_list(301);
});
/*楼栋下拉列表*/
function building_list(communityId) {
    $.ajax({
        url:global_url+'admin/cbuilding/selectList.json',
        dataType:'json',
        xhrFields:{withCredentials:true,useDefaultXhrHerder:false},
        type:'GET',
        async:false,
        data:{communityId:communityId},
        success:function (data) {
            var status=data.code;
            if(status==1){
                var leng=data.data.length;
                var htm_='';
                for(var i=0;i<leng;i++){
                    var cbName =data.data[i].cbName;
                    var sId =data.data[i].sId;
                    htm_+='<li data-sId='+sId+' data-uname='+cbName+'>'+cbName+'</li>';
                }
                $('.building-box').append(htm_);

            }else {
                layer.msg('数据加载失败', {icon: 5});
            }
        }

    });
}
/*单元下拉列表*/
$('.cell_mark').on('click',function () {
    cell(660);
});
function cell(cbuildingId) {
    $.ajax({
        url:global_url+'admin/cinstallunit/selectList.json',
        dataType:'json',
        xhrFields:{withCredentials:true,useDefaultXhrHerder:false},
        type:'GET',
        async:false,
        data:{cbuildingId:cbuildingId},
        success:function (data) {
            var status=data.code;
            if(status==1){
                var leng=data.data.length;
                var htm_='';
                for(var i=0;i<leng;i++){
                    var cbName =data.data[i].cbName;
                    var sId =data.data[i].sId;
                    htm_+='<li data-sId='+sId+' data-uname='+cbName+'>'+cbName+'</li>';
                }
                $('.cell-box').append(htm_);

            }else {
                layer.msg('数据加载失败', {icon: 5});
            }
        }

    });
}
$(document).on('click','.building-box li',function () {
   $(".cell_mark").removeClass("cell-input");
    var sId =$(this).attr('data-sId');
    var type =$(this).attr('data-type');
    $(".floor").attr('data-sId',sId);
    $(".unit").attr('data-sId',sId);
    $(".type").attr('data-type',type);

});
$(document).on('click','.refer_box_input_box li',function () {
    var type =$(this).attr('data-type');
    $(".type").attr('data-type',type);

});
</script>
</html>